package com.example.propertymangesystem.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.propertymangesystem.domain.department;
import com.example.propertymangesystem.mapper.departmentMapper;
import com.example.propertymangesystem.service.IDepartmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class departmentServiceImpl extends ServiceImpl<departmentMapper, department> implements IDepartmentService {
    @Autowired
    private departmentMapper departmentMapper;

    @Override
    public IPage<department> getPage(Integer current, Integer size, department department) {
        QueryWrapper<department> qw = new QueryWrapper<>();
        qw.like(department.getId() != null, "id", department.getId());
        qw.like(department.getInfo() != null, "info", department.getInfo());
        IPage page = new Page(current, size);
        departmentMapper.selectPage(page, qw);
        return page;
    }
}
